package cn.com.blog.web.controller.jump;/**
 * Created by IntelliJ IDEA.
 * User: Yangdx.
 * Date: 2018/4/15.
 * Time: 18:36.
 * Tags: Code, we are serious.
 */

import cn.com.blog.domain.Article;
import cn.com.blog.service.ArticleService;
import cn.com.blog.web.controller.base.BaseController;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import java.util.List;

/**
 * 跳转到登录页面
 *
 * @author
 * @create 2018-04-15 18:36
 **/
@RestController
public class JumpIndexController extends BaseController {
    @Resource
    private ArticleService articleService;

    @RequestMapping(value = "/", method = RequestMethod.GET)
    public ModelAndView defaultTo(Model model) {
        PageHelper.startPage(1,2);
        List<Article> articleList = articleService.selectAll();
        PageInfo pageInfo = new PageInfo(articleList);
        model.addAttribute("articleList", pageInfo);
        return new ModelAndView("client/index");
    }
}
